﻿using System;
using System.Collections.Generic;
using System.Text;

namespace GN.Data.ISqlClient
{
    public interface IQuery
    {
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        T GetModelFromDB<T>(int id);

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        T GetModelFromDB<T>(string where, params IDataParameter[] paramters);

        /// <summary>
        /// 获得数据列表
        /// </summary>
        IList<T> GetListFromDB<T>(string tableName, string strWhere, params IDataParameter[] paramters);

        /// <summary>
        /// 获取记录总数
        /// </summary>
        int GetRecordCountFromDB(string tableName, string strWhere, params IDataParameter[] paramters);

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        IList<T> GetListFromDB<T>(string tableName, int Top, string strWhere, string filedOrder, params IDataParameter[] paramters);

        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="strWhere"></param>
        /// <param name="filedOrder"></param>
        /// <param name="Total"></param>
        /// <param name="paramters"></param>
        /// <returns></returns>
        IList<T> GetListFromDB<T>(string tableName, int PageSize, int PageIndex, string strWhere, string filedOrder, out int Total, params IDataParameter[] paramters);

        /// <summary>
        /// 修改多个字段信息
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        bool UpdateFieldToDB(string tableName, string where, string fileds, params IDataParameter[] paramters);

        /// <summary>
        /// 修改多个字段信息
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        bool UpdateFieldToDB(string tableName, int id, string fileds, params IDataParameter[] paramters);
    }
}
